ahello.x
Before you write your own programs, load and run a small sample.
Select File in the main menu, then Load in the pulldown. Then type
ahello.x in the dialog box that appears and press enter. The program will load for a
couple seconds, then the beginning of its PROLOG will appear in the lower text area.
To run the program, click the Start hot button.
ahello.x prints "Hello Programmer" in the console window.
ahello.x contains the essential features of conventional style programs - a PROLOG with
function declarations, plus at least one function containing executable code.
The PDE displays the PROLOG or one function at a time. To switch between functions,
select from the View category in the main menu, or enter .vf [func], .vp, .v, or
.v- in the upper text area.
your own conventional program
You should now be able to write conventional programs yourself. Just remember, the
console window is the focus of conventional input and output unless redirected to a disk
file by [filenumber].
a$ = INLINE$(prompt$) '
inputs line of text from console
a# = DOUBLE(a$)
'
convert input to floating point
a = XLONG(a$)
' convert input to integer number
PRINT a; a$, a#
'
prints line of text to console
ifile = OPEN(filename$, $$RD) ' opens disk file for read
ofile = OPEN(file$, $$WR) ' opens disk file for write
xfile = OPEN(file$, $$RW) ' opens disk file for read
& write
a$ = INFILE$(ifile) '
reads line of text from disk file
PRINT [ofile], a; a$, a# ' prints strings to disk
file
READ [ifile], a, a$, a[] ' reads binary data from
disk file
WRITE [ofile], a; a$, a[] ' writes binary data to disk
file
The number of bytes read into variables by READ is the number of bytes in the variable before the READ is executed, so you'll probably need to size the string or array appropriately before executing the READ statement. For example:
a$ = NULL$(n) ' prepare a$ to receive n bytes
DIM a[n] ' prepare a[] to receive n+1 elements
The Programming Language Guide and Reference is a good place to look for detailed programming information. For quick reference, select Help Language in the main menu.